﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CCOMDataAccess;

/// <summary>
/// Summary description for UserManager
/// </summary>
public class SessionManager
{
    #region constructor
    public SessionManager()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    #endregion

    public static int getUserID()
    {
        try
        {
            if ((int)HttpContext.Current.Session["UserID"] != null)
            {
                return (int)HttpContext.Current.Session["UserID"];
            }
            return 0;
        }
        catch (NullReferenceException)
        {
            return 0;
        }

    }
    public static bool isLogged()
    {
        try
        {
            if ((bool)HttpContext.Current.Session["isLogged"] != null)
            {
                return (bool)HttpContext.Current.Session["isLogged"];
            }
            return false;
        }
        catch (NullReferenceException)
        {
            return false;
        }
    }
}
